Skip to main content
This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal

HCL Notes/Domino 8.5 Forum (includes Notes Traveler)

HCL Notes/Domino 8.5 Forum (includes Notes Traveler)

Previous Next
Subject: SOLUTION: Error calling method 'xyz' on an object of type 'function [JavaScript Object]'
Feedback Type: Comment
Product Area: Domino Designer on Eclipse (DDE)
Technical Area: Functionality
Platform: Windows XP client
Release: 8.5.1
Reproducible: Not applicable

In XPages, I had a run time error. Specifically:

Error calling method 'appendItemValue(string, string)' on an object of type 'function [JavaScript Object]'

This was from code like:

var docX:NotesDocument=db.CreateDocument;
docX.appendItemValue("Form","FormX");

I searched around and couldn't find the problem, so now that I've got the solution, I'm sharing. The problem was that I had forgotten the parentheses at the end of CreateDocument. Therefore, I was assigning the JavaScript function of NotesDatabase.CreateDocument (a function is an object in JavaScript) to docX, not executing NotesDatabase.CreateDocument() and returning the output. Easy mistake, easy fix.

So, the error message makes complete sense to me _now_, but since this was the first time I've made this mistake, it took quite a lot of fiddling before realizing what the problem was.

Hopefully this post will help someone out.

The biggest surprise to me from all this is: I had declared docX as a NotesDocument and I thought this was strict datatyping, but apparently server side JavaScript doesn't pay attention to declared datatypes or else the first line of the above code should have failed because a NotesDocument is not an ancestor of a JavaScript function object.


Feedback number WEBB7ZE8YR created by ~Holly Brefreemannivu on 01/05/2010

Status: Open
Comments:





Printer-friendly

Search this forum

Member Tools


RSS Feeds

 RSS feedsRSS
All forum posts RSS
All main topics RSS